<template>
  <h6 style="color: crimson">商品与赠品管理--><a href="http://localhost:5173/gift">赠品管理</a>-->追踪审核详情</h6>
<el-button type="primary" icon="Pointer" @click="chooseGift">选择赠品</el-button><br>
        赠品名称:  <br>{{uModel.gname}}
  <hr> 赠品类型:  <br>{{uModel.gtype}}
  <hr> 赠品型号:  <br>{{uModel.gmodel}}
  <hr> 赠品单价:  <br>{{uModel.marketPrice}}
  <hr> 采购成本:  <br>{{uModel.purchasePrice}}
  <hr> 赠品数量:  <br>{{uModel.count}}
  <hr> 赠品存量: <br>{{uModel.minStock}}
  <hr> 入库数量：<br> {{uModel.count}}
  <hr>
  审批意见：
  <el-input
      v-model="uModel.opinion"
      style="width: 800px"
      :autosize="{ minRows: 3, maxRows: 10 }"
      type="textarea"
      placeholder="审批意见"
      disabled
  /> <hr>
  审核人： admin  <br> 审核状态：{{giftModel.applyStatus}} <br>
  <el-button type="primary" @click="router.back()">返回</el-button>

</template>

<script setup>
import {ref,reactive,onMounted,getCurrentInstance} from "vue";
import axios from "@/plugins/axios.js";
import {ElMessage} from "element-plus";
import router from "@/router/index.js";
import {giftStore} from "@/stores/GiftModel.js";
import {
  Plus,Search,Delete,Check,Right,Pointer
} from '@element-plus/icons-vue'
const giftModel = giftStore();

const uModel=ref({
  id:'',
  giftName:'',
  giftType:'',
  giftModel:'',
  marketPrice:'',
  purchasePrice:'',
  giftNum:'',
  minStock:'',
  count:'',
  opinion:''
})
const subForm=ref({
  id:'',
  count:'',
  opinion:'',
  applyStatus:null,
})

const chooseGift = () => {
router.push({
  path:"/gift/choose",
})
  console.log(giftModel.userModel)
}
onMounted(() => {
  console.log(giftModel.$id)
  if(giftModel.$id!=='giftStore'){
    axios.get("/gift2goods/getGift2GoodsDetail/"+giftModel.$id).then(res=>{
      if(res.code===200){
        uModel.value=res.data
        axios.get("/gift2goods/getGifts2GoodsBYId/"+giftModel.$id).then(res=>{
          if(res.code===200){
            uModel.value.opinion=res.data.opinion
            uModel.value.count=res.data.count
            console.log(uModel.value)
          }
        })
      }
    })
  }

});

</script>

<style >

</style>